package com.opgea.crm.domain.entities;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.opgea.crm.domain.entities.security.CrmUser;

@Entity
@Table(name="projectdocuments")
public class ProjectDocuments implements Serializable {

	@Id
	@GeneratedValue
	@Column(name="id")
	private Long id;
	
	@JoinColumn(name="project_id", referencedColumnName="id")
	@ManyToOne
	private ProjectDetails project;
	
	@ManyToOne(cascade=CascadeType.REFRESH)
	@JoinColumn(name="createdBy", referencedColumnName="username")
	private CrmUser createdBy;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="createdat")
	private Date createdAt;
	
	@Column(name="receiveDate")
	@Temporal(TemporalType.DATE)
	private Date receiveDate;
	
	@Column(name="senderName")
	private String senderName;
	
	@Column(name="documentName")
	private String documentName;
	
	@Column(name="fileName")
	private String fileName;
	
	@Column(name="fileSize")
	private long fileSize;
	
	@Column(name="content")
	private byte[] content;
	
	@Column(name="documentType")
	private int documentType;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public ProjectDetails getProject() {
		return project;
	}

	public void setProject(ProjectDetails project) {
		this.project = project;
	}

	public void setCreatedBy(CrmUser createdBy) {
		this.createdBy = createdBy;
	}

	public CrmUser getCreatedBy() {
		return createdBy;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public Date getReceiveDate() {
		return receiveDate;
	}

	public void setReceiveDate(Date receiveDate) {
		this.receiveDate = receiveDate;
	}

	public String getSenderName() {
		return senderName;
	}

	public void setSenderName(String senderName) {
		this.senderName = senderName;
	}

	public String getDocumentName() {
		return documentName;
	}

	public void setDocumentName(String documentName) {
		this.documentName = documentName;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public long getFileSize() {
		return fileSize;
	}

	public void setFileSize(long fileSize) {
		this.fileSize = fileSize;
	}

	public byte[] getContent() {
		return content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	public int getDocumentType() {
		return documentType;
	}

	public void setDocumentType(int documentType) {
		this.documentType = documentType;
	}
	
	

}
